#ifndef __SmartHomeMonitorServer_H__ 
#define __SmartHomeMonitorServer_H__
#include "ThreadPool.hpp"
#include "TcpServer.hpp"
#include "BusinessService.hpp"
#include "MySQLClient.hpp"
#include "videoRecord.hpp"
#include <iostream>
#include <mutex>
#include <unordered_map>
#include <memory>
using std::cout;
using std::endl;


namespace wd{

class SmartHomeMonitorServer{

public:
    SmartHomeMonitorServer(unsigned short port, const string ip, int threadNum, int sizeQue);


#if 1




#endif

    void start();
    void stop();

private:
    void onConnection(TcpConnectionPtr);
    void onMessage(TcpConnectionPtr);
    void onClosed(TcpConnectionPtr);

    void startAllRecorders();

private:
    ThreadPool _threadpool;
    TcpServer  _server;
    
    std::unordered_map<string, std::shared_ptr<RTSPRecorder>> _recorders;
    std::mutex _recorderMutex;

};





} //end of namespace wd

#endif

